home *** CD-ROM | disk | FTP | other *** search
Wrap
XXXXmmmmCCCClllliiiippppbbbbooooaaaarrrrddddSSSSttttaaaarrrrttttCCCCooooppppyyyy((((3333XXXX)))) UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV XXXXmmmmCCCClllliiiippppbbbbooooaaaarrrrddddSSSSttttaaaarrrrttttCCCCooooppppyyyy((((3333XXXX)))) NNNNAAAAMMMMEEEE _X_m_C_l_i_p_b_o_a_r_d_S_t_a_r_t_C_o_p_y - A clipboard function that sets up a storage and data structure SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS #include <Xm/Xm.h> #include <Xm/CutPaste.h> int _X_m_C_l_i_p_b_o_a_r_d_S_t_a_r_t_C_o_p_y (ddddiiiissssppppllllaaaayyyy,,,, wwwwiiiinnnnddddoooowwww,,,, cccclllliiiipppp____llllaaaabbbbeeeellll,,,, ttttiiiimmmmeeeessssttttaaaammmmpppp,,,, wwwwiiiiddddggggeeeetttt,,,, ccccaaaallllllllbbbbaaaacccckkkk,,,, iiiitttteeeemmmm____iiiidddd) _D_i_s_p_l_a_y **** ddddiiiissssppppllllaaaayyyy; _W_i_n_d_o_w wwwwiiiinnnnddddoooowwww; _X_m_S_t_r_i_n_g cccclllliiiipppp____llllaaaabbbbeeeellll; _T_i_m_e ttttiiiimmmmeeeessssttttaaaammmmpppp; _W_i_d_g_e_t wwwwiiiiddddggggeeeetttt; _X_m_C_u_t_P_a_s_t_e_P_r_o_cccccaaaallllllllbbbbaaaacccckkkk; _l_o_n_g **** iiiitttteeeemmmm____iiiidddd; DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN _X_m_C_l_i_p_b_o_a_r_d_S_t_a_r_t_C_o_p_y sets up storage and data structures to receive clipboard data. An application calls this function during a cut or copy operation. The data item that these structures receive then becomes the next data item in the clipboard. Copying a large piece of data to the clipboard can take a long time. It is possible that, once copied, no application will ever request that data. The Motif Toolkit provides a mechanism so that an application does not need to actually pass data to the clipboard until the data has been requested by some application. Instead, the application passes format and length information in _X_m_C_l_i_p_b_o_a_r_d_C_o_p_y to the clipboard functions, along with a widget ID and a callback function address that is passed in _X_m_C_l_i_p_b_o_a_r_d_S_t_a_r_t_C_o_p_y. The widget ID is needed for communications between the clipboard functions in the application that owns the data and the clipboard functions in the application that requests the data. The callback functions are responsible for copying the actual data to the clipboard via _X_m_C_l_i_p_b_o_a_r_d_C_o_p_y_B_y_N_a_m_e. The callback function is also called if the data item is removed from the clipboard, and the actual data is therefore no longer needed. ddddiiiissssppppllllaaaayyyy Specifies a pointer to the _D_i_s_p_l_a_y structure that was returned in a previous call to _X_O_p_e_n_D_i_s_p_l_a_y or _X_t_D_i_s_p_l_a_y. wwwwiiiinnnnddddoooowwww Page 1 (printed 11/11/03) XXXXmmmmCCCClllliiiippppbbbbooooaaaarrrrddddSSSSttttaaaarrrrttttCCCCooooppppyyyy((((3333XXXX)))) UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV XXXXmmmmCCCClllliiiippppbbbbooooaaaarrrrddddSSSSttttaaaarrrrttttCCCCooooppppyyyy((((3333XXXX)))) Specifies a widget's window ID that relates the application window to the clipboard. The widget's window ID can be obtained by using _X_t_W_i_n_d_o_w. The same application instance should pass the same window ID to each of the clipboard functions that it calls. cccclllliiiipppp____llllaaaabbbbeeeellll Specifies the label to be associated with the data item. This argument is used to identify the data item, for example, in a clipboard viewer. An example of a label is the name of the application that places the data in the clipboard. ttttiiiimmmmeeeessssttttaaaammmmpppp Specifies the time of the event that triggered the copy. A valid timestamp must be supplied; it is not sufficient to use _C_u_r_r_e_n_t_T_i_m_e. wwwwiiiiddddggggeeeetttt Specifies the ID of the widget that receives messages requesting data previously passed by name. This argument must be present in order to pass data by name. Any valid widget ID in your application can be used for this purpose and all the message handling is taken care of by the cut and paste functions. ccccaaaallllllllbbbbaaaacccckkkk Specifies the address of the callback function that is called when the clipboard needs data that was originally passed by name. This is also the callback to receive the _d_e_l_e_t_e message for items that were originally passed by name. This argument must be present in order to pass data by name. iiiitttteeeemmmm____iiiidddd Specifies the number assigned to this data item. The application uses this number in calls to _X_m_C_l_i_p_b_o_a_r_d_C_o_p_y, _X_m_C_l_i_p_b_o_a_r_d_E_n_d_C_o_p_y, and _X_m_C_l_i_p_b_o_a_r_d_C_a_n_c_e_l_C_o_p_y. For more information on passing data by name, see _X_m_C_l_i_p_b_o_a_r_d_C_o_p_y(_3_X) and _X_m_C_l_i_p_b_o_a_r_d_C_o_p_y_B_y_N_a_m_e(_3_X). The wwwwiiiiddddggggeeeetttt and ccccaaaallllllllbbbbaaaacccckkkk arguments must be present in order to pass data by name. The callback format is as follows: void (*ccccaaaallllllllbbbbaaaacccckkkk)))) (wwwwiiiiddddggggeeeetttt,,,, ddddaaaattttaaaa____iiiidddd,,,, pppprrrriiiivvvvaaaatttteeee,,,, rrrreeeeaaaassssoooonnnn) _W_i_d_g_e_t wwwwiiiiddddggggeeeetttt; _i_n_t *ddddaaaattttaaaa____iiiidddd; _i_n_t *pppprrrriiiivvvvaaaatttteeee; _i_n_t *rrrreeeeaaaassssoooonnnn; wwwwiiiiddddggggeeeetttt Page 2 (printed 11/11/03) XXXXmmmmCCCClllliiiippppbbbbooooaaaarrrrddddSSSSttttaaaarrrrttttCCCCooooppppyyyy((((3333XXXX)))) UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV XXXXmmmmCCCClllliiiippppbbbbooooaaaarrrrddddSSSSttttaaaarrrrttttCCCCooooppppyyyy((((3333XXXX)))) Specifies the ID of the widget passed to this function. ddddaaaattttaaaa____iiiidddd Specifies the identifying number returned by _X_m_C_l_i_p_b_o_a_r_d_C_o_p_y, which identifies the pass-by-name data. pppprrrriiiivvvvaaaatttteeee Specifies the private information passed to _X_m_C_l_i_p_b_o_a_r_d_C_o_p_y. rrrreeeeaaaassssoooonnnn Specifies the reason, which is either _X_m_C_R__C_L_I_P_B_O_A_R_D__D_A_T_A__D_E_L_E_T_E or _X_m_C_R__C_L_I_P_B_O_A_R_D__D_A_T_A__R_E_Q_U_E_S_T. RRRREEEETTTTUUUURRRRNNNN VVVVAAAALLLLUUUUEEEE _C_l_i_p_b_o_a_r_d_S_u_c_c_e_s_s The function is successful. _C_l_i_p_b_o_a_r_d_L_o_c_k_e_d The function failed because the clipboard was locked by another application. The application can continue to call the function again with the same parameters until the lock goes away. This gives the application the opportunity to ask if the user wants to keep trying or to give up on the operation. RRRREEEELLLLAAAATTTTEEEEDDDD IIIINNNNFFFFOOOORRRRMMMMAAAATTTTIIIIOOOONNNN _X_m_C_l_i_p_b_o_a_r_d_C_a_n_c_e_l_C_o_p_y(_3_X), _X_m_C_l_i_p_b_o_a_r_d_C_o_p_y(_3_X), _X_m_C_l_i_p_b_o_a_r_d_C_o_p_y_B_y_N_a_m_e(_3_X), _X_m_C_l_i_p_b_o_a_r_d_E_n_d_C_o_p_y(_3_X), _X_m_C_l_i_p_b_o_a_r_d_E_n_d_R_e_t_r_i_e_v_e(_3_X), _X_m_C_l_i_p_b_o_a_r_d_I_n_q_u_i_r_e_C_o_u_n_t(_3_X), _X_m_C_l_i_p_b_o_a_r_d_I_n_q_u_i_r_e_F_o_r_m_a_t(_3_X), _X_m_C_l_i_p_b_o_a_r_d_I_n_q_u_i_r_e_L_e_n_g_t_h(_3_X), _X_m_C_l_i_p_b_o_a_r_d_I_n_q_u_i_r_e_P_e_n_d_i_n_g_I_t_e_m_s(_3_X), _X_m_C_l_i_p_b_o_a_r_d_L_o_c_k(_3_X), _X_m_C_l_i_p_b_o_a_r_d_R_e_g_i_s_t_e_r_F_o_r_m_a_t(_3_X), _X_m_C_l_i_p_b_o_a_r_d_R_e_t_r_i_e_v_e(_3_X), _X_m_C_l_i_p_b_o_a_r_d_S_t_a_r_t_R_e_t_r_i_e_v_e(_3_X), _X_m_C_l_i_p_b_o_a_r_d_U_n_d_o_C_o_p_y(_3_X), _X_m_C_l_i_p_b_o_a_r_d_U_n_l_o_c_k(_3_X), and _X_m_C_l_i_p_b_o_a_r_d_W_i_t_h_d_r_a_w_F_o_r_m_a_t(_3_X). Page 3 (printed 11/11/03)